-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Console and Debugger #31
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this! Left some thoughts below.
I addressed this in my inline comments.
Can you link me to where the upstream
Can you explain what wasn't working before you added this? I'm not sure I'm following. |
Co-authored-by: Rocket <[email protected]>
Co-authored-by: Rocket <[email protected]>
Co-authored-by: Rocket <[email protected]>
Co-authored-by: Rocket <[email protected]>
Sounds good. Thanks for clarifying.
The debug gem in the docker ruby 3.3.1-slim image is listed as version 1.9.1, which I was able to confirm on the dockerhub website:
However, if I lock my debug gem to version 1.9.1, and re-bundle and create a new containerized app, it works as expected. I described how I'm running my docker container in the inline comment here, are you doing it differently?
Responded to your inline comment. |
Got it! Thanks. I think what we should do is explicitly install a global version of the # Install system-wide gems for development
# This version must match Gemfile.lock. Otherwise, `rdbg` will fail.
RUN gem install debug -v 1.9.2
I think your change is good and that we don't need to expand out to 0.0.0.0. |
- If you have multiple Rails applications with debuggers running, you'll have to specify the port to attach the debugger to. For more information, see the [Rails debug gem documentation](https://github.com/ruby/debug?tab=readme-ov-file#remote-debugging). | ||
- If you're running the app in a container, such as with `make start-container`: | ||
- `rdbg` in the terminal on your host machine will not be able to see the port in the container to connect to the debugger. | ||
- Instead, run `rdbg` inside the container: `docker compose exec app-rails rdbg -An` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running rdbg -An
gave me this:
DEBUGGER (client): Connected. PID:10, $0:bin/rails
DEBUGGER (client): Type `Ctrl-C` to enter the debug console.
And I needed to hit Ctrl-C
to enter the debug console. Whereas rdbg -A
allowed me to skip hitting Ctrl-C
. Any reason we need -n
? I didn't see anything in particular in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, running rdbg
(both natively and in the container), I got this:
DEBUGGER (client): Connected. PID:10, $0:bin/rails
# No sourcefile available for /usr/local/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/single.rb
=>#0 [C] Thread#join at /usr/local/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/single.rb:63
#1 Puma::Single#run at /usr/local/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/single.rb:63
# and 20 frames (use `bt' command for all frames)
Stop by SIGURG
(rdbg:remote)
This issue is the only reference I found about this. I was able to hit c
to continue past it, but it was persistent. Did you run into this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! i removed the n
from the guidance, however that enables the --nonstop flag which is used to tell rdbg
to not stop at the beginning of the script. I saw a bunch of troubleshooting tips that advised adding it, but it's not necessary in all cases.
I was only able to reproduce what you were seeing by connecting the debugger before the application hit the debug statement. But once the debug statement was hit by the user action, then the debugger terminal updated properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see! Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!
Ticket
Changes
Questions for reviewers
make rails-console
though I think elsewhere it says to usemake init-native/container
andmake start-native/container
for local native and local docker development. Should we change it here to be consistent?0.0.0.0
?Testing